package com.pn.controller;

import com.pn.entity.InStore;
import com.pn.entity.Store;
import com.pn.service.InstoreService;
import com.pn.service.ProductService;
import com.pn.service.StoreService;
import com.pn.utils.PageBean;
import com.pn.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("instore")
public class InstoreController {
    @Autowired
    private InstoreService instoreService;

    @Autowired
    private StoreService storeService;

    //查询所有仓库
    @GetMapping("/store-list")
    public Result InBystoreList(){
        List<Store> stores = storeService.storeList();
        return Result.ok(stores);
    }

    //显示入库列表
    @GetMapping("/instore-page-list")
    public Result<PageBean<InStore>> instorePageList(InStore inStore){
        PageBean pageBean = instoreService.instorePageList(inStore);
        return Result.ok(pageBean);
    }

    //确认入库
    @PutMapping("/instore-confirm")
    public Result instoreConfirm(@RequestBody InStore inStore){
        Result result = instoreService.inStoreConfirm(inStore);
        return result;
    }
}
